Array.prototype.in_array = function(p_val)
{
      for(var i = 0, l = this.length; i < l; i++)
      {
            if (this[i] == p_val)
            {
                  return true;
            }
      }

      return false;
}

function getElementsByClassName(classname, node)
{
      if(!node) node = document.getElementsByTagName("body")[0];
      var a = [];
      var re = new RegExp('\\b' + classname + '\\b');
      var els = node.getElementsByTagName("*");
      for(var i=0,j=els.length; i<j; i++)
          if(re.test(els[i].className))a.push(els[i]);
      return a;
}

function elementSetStyle(el, css)
{
      if(window.attachEvent && navigator.userAgent.toLowerCase().indexOf("opera") == -1) el.style.setAttribute('cssText', el.style.getAttribute('cssText')+css);
      else el.setAttribute('style', el.getAttribute('style')+css);
}

function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue)
{
      var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
      var arrReturnElements = new Array();
      var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
      var oCurrent;
      var oAttribute;

      for(var i=0; i<arrElements.length; i++)
      {
            oCurrent = arrElements[i];
            oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);

            if(typeof oAttribute == "string" && oAttribute.length > 0)
            {
                  if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttribute.match(strAttributeValue)))
                  {
                        arrReturnElements.push(oCurrent);
                  }
            }
      }

      return arrReturnElements;
}

function getStyle(oElm, strCssRule)
{
      var strValue = "";

      if (document.defaultView && document.defaultView.getComputedStyle)
      {
            strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
      }
      else if(oElm.currentStyle)
      {
            strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1)
            {
                  return p1.toUpperCase();
            });

            strValue = oElm.currentStyle[strCssRule];
      }

      return strValue;
}


function getElmById(Elm)
{
      return document.getElementById(Elm);
}

var msepAPI = new Class({ version: "1.00" });

msepAPI.prototype.Corners = new Class(
{
      Implements: Options,

      options: {
            container: null,
            points: [],
            type: 0,
            width: 0,
            height: 0
      },

      initialize: function(options)
      {
            this.setOptions(options);
            if (this.options.container == null) alert('Container parameter is empty.');
            if (getElmById(this.options.container)) this.options.container = getElmById(this.options.container);
            else alert('Container was not found.');
      },

      getPoints: function()
      {
            var x0;
            var y0;
            var x;
            var y;
            var ddF_x;
            var ddF_y;
            var f;

            if (this.options.type == 0)
            {
                  x0 = this.options.radius;
                  y0 = this.options.radius;
            }
            else if (this.options.type == 1)
            {
                  x0 = this.options.radius;
                  y0 = 0;
            }
            else if (this.options.type == 2)
            {
                  x0 = 0;
                  y0 = this.options.radius;
            }
            else if (this.options.type == 3)
            {
                  x0 = 0;
                  y0 = 0;
            }

            f = 1 - this.options.radius;
            ddF_x = 1;
            ddF_y = -2 * this.options.radius;
            x = 0;
            y = this.options.radius;

            if (this.options.type == 1 || this.options.type == 3) this.addPoint(x0, parseInt(y0 + this.options.radius));
            if (this.options.type == 0 || this.options.type == 2) this.addPoint(x0, parseInt(y0 - this.options.radius));
            if (this.options.type == 2 || this.options.type == 3) this.addPoint(parseInt(x0 + this.options.radius), y0);
            if (this.options.type == 0 || this.options.type == 1) this.addPoint(parseInt(x0 - this.options.radius), y0);

            while (x < y)
            {
                  ddF_x = 2 * x + 1;
                  ddF_y = -2 * y;
                  f = x*x + y*y - this.options.radius*this.options.radius + 2*x - y + 1;

                  if (f >= 0)
                  {
                        y--;
                        ddF_y += 2;
                        f += ddF_y;
                  }

                  x++;
                  ddF_x += 2;
                  f += ddF_x;

                  if (this.options.type == 0) this.addPoint(parseInt(x0 - x), parseInt(y0 - y), false);
                  if (this.options.type == 0) this.addPoint(parseInt(x0 - y), parseInt(y0 - x), true);

                  if (this.options.type == 1) this.addPoint(parseInt(y0 + x), parseInt(x0 - y), false);
                  if (this.options.type == 1) this.addPoint(parseInt(y0 + y), parseInt(x0 - x), true);

                  if (this.options.type == 2) this.addPoint(parseInt(y0 - x), parseInt(x0 + y), false);
                  if (this.options.type == 2) this.addPoint(parseInt(y0 - y), parseInt(x0 + x), true);

                  if (this.options.type == 3) this.addPoint(parseInt(x0 + x), parseInt(y0 + y), false);
                  if (this.options.type == 3) this.addPoint(parseInt(x0 + y), parseInt(y0 + x), true);
            }
      },

      addPoint: function(x, y, top)
      {
                  this.options.points.push(x+"|"+y)

                  if (x > this.options.width)
                  {
                        this.options.width = x;
                  }

                  if (y > this.options.height)
                  {
                        this.options.height = y;
                  }

                  if (this.options.type == 0 || this.options.type == 2)
                  {
                        var x0 = x;

                        while (x0 < parseInt(this.options.radius))
                        {
                              x0++;

                              this.options.points.push(x0+"|"+y);
                        }

                        if (top)
                        {
                              x--;
                              this.options.points.push(x+"x"+y);
                        }
                        else if (!top)
                        {
                              if (this.options.type == 0)
                              {
                                    y--;
                                    this.options.points.push(x+"x"+y);
                              }
                              else if (this.options.type == 2)
                              {
                                    y++;
                                    this.options.points.push(x+"x"+y);
                              }
                        }
                  }
                  else if (this.options.type == 1 || this.options.type == 3)
                  {
                        var x0 = x;

                        while (x0 > 0)
                        {
                              x0--;

                              this.options.points.push(x0+"|"+y);
                        }

                        if (top)
                        {
                              x++;
                              this.options.points.push(x+"x"+y);
                        }
                        else if (!top)
                        {
                              if (this.options.type == 1)
                              {
                                    y--;
                                    this.options.points.push(x+"x"+y);
                              }
                              else if (this.options.type == 3)
                              {
                                    y++;
                                    this.options.points.push(x+"x"+y);
                              }
                        }
                  }
      },

      drawCorners: function()
      {
            /*if (navigator.userAgent.toLowerCase().indexOf("opera") != -1|| navigator.userAgent.toLowerCase().indexOf("msie") != -1)
            {*/
                  this.getPoints();

                  this.loopPoints();

                  //elementSetStyle(this.options.container, 'background-color: transparent; position: relative; overflow: hidden; width: '+parseInt(this.options.width+1)+'px; height: '+parseInt(this.options.height+1)+'px;');
            /*}
            else
            {
                  elementSetStyle(this.options.container, 'height: 200px; background-color: '+getStyle(this.options.container, 'background-color')+'; border-radius: '+this.options.radius+'px; -khtml-border-radius: '+this.options.radius+'px; -moz-border-radius: '+this.options.radius+'px; -webkit-border-radius: '+this.options.radius+'px;');
            }*/
      },

      loopPoints: function()
      {
            var y = 0;

            var margin_left = getStyle(this.options.container, 'padding-left')+getStyle(this.options.container, 'border-left');
            var width = getStyle(this.options.container, 'width');
            alert(width);

            var top_corners = document.createElement('div');
            elementSetStyle(top_corners, 'position: absolute; border: 1px solid #000000; width: auto; height: '+this.options.height+'px; margin-left: -'+margin_left+';');

            var bottom_corners = document.createElement('div');
            elementSetStyle(bottom_corners, 'position: absolute; border: 1px solid #000000; width: auto; height: '+this.options.height+'px; margin-left: -'+margin_left+';');

            this.options.container.insertBefore(top_corners, this.options.container.firstChild);
            this.options.container.appendChild(bottom_corners);

            /*var table = new Element('div', {'class': 'table'});
            elementSetStyle(table, 'width: '+parseInt(this.options.width+1)+'px; height: '+parseInt(this.options.height+1)+'px;');

            var shadow = [];

            while (y < parseInt(this.options.radius+1))
            {
                  x = 0;

                  var row = new Element('div', {'class': 'row'});

                  while (x < parseInt(this.options.radius+1))
                  {
                        var cell = new Element('div', {'class': 'column'});

                        if (this.options.points.in_array(x+"|"+y))
                        {
                              elementSetStyle(cell, 'background-color: #FF0000;');
                        }
                        else if (this.options.points.in_array(x+"x"+y))
                        {
                              if (shadow.in_array(x))
                              {
                                    elementSetStyle(cell, 'background-color: #cccccc;');
                              }
                              else
                              {
                                    elementSetStyle(cell, 'background-color: #cccccc;');
                              }

                              shadow.push(x);
                        }
                        else
                        {
                              elementSetStyle(cell, 'background-color: transparent;');
                        }

                        cell.inject(row);

                        x++;
                  }

                  row.inject(table);

                  y++;
            }

            table.inject(this.options.container);*/
      }

});

msepAPI.prototype.Crop = new Class(
{
      initialize: function()
      {
            this.cropper = new Lasso.Crop('profile_photo',{
                  ratio: false,
                  preset: [235,140,505,340],
                  min: [50,50],
                  handleSize: 6,
                  opacity: .6,
                  color: '#000000',
                  border: './images/msep/crop.gif',
                  onResize: this.updateCoords.bind(this)
            });
      },

      updateCoords: function(pos)
      {
            this.x = pos.x;
            this.y = pos.y;
            this.w = pos.w;
            this.h = pos.h;
      }
});

msepAPI.prototype.Comments = new Class({Implements:[Options],Base:{},page:1,total:0,changed:false,isEditing:false,options:{ajaxURL:"msep_js.php",ajaxMethod:"post",ajaxSecure:false,canComment:false,commentHTML:false,commentCode:false,originalHeight:70,type:false,typeIdentifier:false,typeID:false,paginate:false,cpp:false,commentLinks:{reply:false,walltowall:false},object_owner:false,object_owner_id:false,typeTab:false,typeCol:false,typeTabParent:false,typeColParent:false,typeChild:false},initialize:function(a){this.setOptions(a);if(this.options.initialTotal){this.total=this.options.initialTotal}var b=this;window.addEvent("domready",function(){b.showPostComment();b.options.originalHeight=textarea_autogrow("comment_body");b.getComments(1)})},showPostComment:function(){var c="";c+="<div class='comment_headline'>"+SocialEngine.Language.Translate(854)+" (<span class='tc' id='"+this.options.type+"_"+this.options.typeID+"_totalcomments'>"+this.total+"</span>)</div>";if(this.options.canComment){c+="<form action='msep_js.php' method='post' target='ajaxframe' name='comment_post_form'><div class='profile_postcomment'><textarea name='comment_body' id='comment_body' cols='25' class='comment_area'>"+SocialEngine.Language.Translate(829)+"</textarea>";if(this.options.commentHTML){c+="<div style='margin-top: 5px;'>"+SocialEngine.Language.TranslateFormatted(1034,[this.options.commentHTML])+"</div>"}if(this.options.commentCode){c+="<div style='float: left; margin-top: 5px;'><a href='javascript:void(0);' onClick=\"this.blur();$('secure_image').src=$('secure_image').src+'?'+(new Date()).getTime();\"><img src='./images/secure.php' id='secure_image' border='0' height='20' width='67' class='signup_code'></a> <input type='text' name='comment_secure' id='comment_secure' class='text' size='6' maxlength='10' /> <img src='./images/icons/tip.gif' border='0' class='Tips1' style='vertical-align: middle;' title='"+SocialEngine.Language.Translate(856)+"' /></div>"}c+="<div style='text-align: right; margin-top: 5px;'><input type='submit' id='comment_submit' class='button' value='"+SocialEngine.Language.Translate(833)+"' /><input type='hidden' name='task' value='comment_post' /><input type='hidden' name='type' value='"+this.options.type+"' /><input type='hidden' name='iden' value='"+this.options.typeIdentifier+"' /><input type='hidden' name='value' value='"+this.options.typeID+"' />";if(this.options.object_owner&&this.options.object_owner_id){c+='<input type="hidden" name="object_owner" value="'+this.options.object_owner+'"><input type="hidden" name="object_owner_id" value="'+this.options.object_owner_id+'">'}else{c+='<input type="hidden" name="user" value="'+SocialEngine.Owner.user_info.user_username+'">'}if(this.options.typeTab){c+="<input type='hidden' name='tab' value='"+this.options.typeTab+"'>"}if(this.options.typeCol){c+="<input type='hidden' name='col' value='"+this.options.typeCol+"'>"}if(this.options.typeTabParent){c+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">'}if(this.options.typeColParent){c+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">'}if(this.options.typeChild){c+='<input type="hidden" name="child" value="1">'}c+="</div><div id='comment_error' style='color: #FF0000; display: none;'></div></div></form>"}c+='<div style="display: none;" id="confirmcommentdelete"><div style="margin-top: 10px;">'+SocialEngine.Language.Translate(1026)+'</div><br /><form action="msep_js.php" method="post" target="ajaxframe"><input type="submit" class="button" value="'+SocialEngine.Language.Translate(175)+'" onClick="parent.TB_remove();"> <input type="button" class="button" value="'+SocialEngine.Language.Translate(39)+'" onClick="parent.TB_remove();"><input type="hidden" name="task" value="comment_delete"><input type="hidden" name="comment_id" id="del_comment_id" value="0"><input type="hidden" name="type" value="'+this.options.type+'"><input type="hidden" name="iden" value="'+this.options.typeIdentifier+'"><input type="hidden" name="value" value="'+this.options.typeID+'">';if(this.options.object_owner&&this.options.object_owner_id){c+='<input type="hidden" name="object_owner" value="'+this.options.object_owner+'"><input type="hidden" name="object_owner_id" value="'+this.options.object_owner_id+'">'}else{c+='<input type="hidden" name="user" value="'+SocialEngine.Owner.user_info.user_username+'">'}if(this.options.typeTab){c+='<input type="hidden" name="tab" value="'+this.options.typeTab+'">'}if(this.options.typeCol){c+='<input type="hidden" name="col" value="'+this.options.typeCol+'">'}if(this.options.typeTabParent){c+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">'}if(this.options.typeColParent){c+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">'}if(this.options.typeChild){c+='<input type="hidden" name="child" value="1">'}c+="</form></div>";var a=$(this.options.type+"_"+this.options.typeID+"_postcomment");a.innerHTML=c;var b=this;if(this.options.canComment){a.getElement("form").addEvent("submit",function(d){b.checkText(d)});a.getElement("textarea").addEvent("focus",function(){b.removeText(this)});a.getElement("textarea").addEvent("blur",function(){b.addText(this)});a.getElement("form").addEvent("submit",function(d){b.doCommentPost(d)})}},doCommentPost:function(d){var c=new Event(d);var a={task:"comment_post",album_id:this.options.album_id,album_name:this.options.album_name,type:this.options.type,iden:this.options.typeIdentifier,value:this.options.typeID,tab:this.options.typeTab,col:this.options.typeCol};if(this.options.typeTabParent){a.tab_parent=this.options.typeTabParent}if(this.options.typeColParent){a.col_parent=this.options.typeColParent}if(this.options.typeChild){a.child=this.options.typeChild}if(this.options.object_owner&&this.options.object_owner_id){a.object_owner=this.options.object_owner;a.object_owner_id=this.options.object_owner_id}else{a.user=SocialEngine.Owner.user_info.user_username}if($type(document.comment_post_form.comment_body)){a.comment_body=document.comment_post_form.comment_body.value}if($type(document.comment_post_form.comment_secure)){a.comment_secure=document.comment_post_form.comment_secure.value}var f=this;var b=new Request.JSON({url:this.options.ajaxURL,method:this.options.ajaxMethod,secure:this.options.ajaxSecure,data:a,onComplete:function(e,g){f.addComment(e.is_error,e.comment_body,e.comment_date)}}).send();c.stop()},doCommentEdit:function(){var a={task:"comment_edit",type:this.options.type,iden:this.options.typeIdentifier,value:this.options.typeID,user:SocialEngine.Owner.user_info.user_username};if($type(document.editCommentForm.comment_id)){a.comment_id=document.editCommentForm.comment_id.value}if($type(document.editCommentForm.comment_edit)){a.comment_edit=document.editCommentForm.comment_edit.value}var c=this;var b=new Request.JSON({url:this.options.ajaxURL,method:this.options.ajaxMethod,secure:this.options.ajaxSecure,data:a,onComplete:function(d,e){c.getComments()}}).send()},doCommentDelete:function(f,b){var d=new Event(f);var a={task:"comment_delete",comment_id:b,type:this.options.type,iden:this.options.typeIdentifier,value:this.options.typeID,tab:this.options.typeTab,col:this.options.typeCol,user:SocialEngine.Owner.user_info.user_username};if(this.options.typeTabParent){a.tab_parent=this.options.typeTabParent}if(this.options.typeColParent){a.col_parent=this.options.typeColParent}if(this.options.typeChild){a.child=this.options.typeChild}if(this.options.object_owner){a.object_owner=this.options.object_owner}if(this.options.object_owner_id){a.object_owner_id=this.options.object_owner_id}if($type(document.commentDeleteForm.comment_body)){a.comment_body=document.commentDeleteForm.comment_body.value}if($type(document.commentDeleteForm.comment_secure)){a.comment_secure=document.commentDeleteForm.comment_secure.value}var g=this;var c=new Request.JSON({url:this.options.ajaxURL,method:this.options.ajaxMethod,secure:this.options.ajaxSecure,data:a,onComplete:function(e,h){g.getComments()}}).send();d.stop()},getComments:function(e){if(e=="next"){this.page++}else{if(e=="previous"){this.page--}else{if($type(e)){this.page=e}}}if(this.options.paginate){window.scroll(0,0)}else{this.options.cpp=this.total}if(this.options.object_owner&&this.options.object_owner_id){var d=this.options.object_owner;var a=this.options.object_owner_id;var b=""}else{var d="";var a="";var b=SocialEngine.Owner.user_info.user_username}var f=this;var c=new Request.JSON({url:this.options.ajaxURL,method:this.options.ajaxMethod,secure:this.options.ajaxSecure,data:{task:"comment_get",user:b,object_owner:d,object_owner_id:a,type:this.options.type,iden:this.options.typeIdentifier,value:this.options.typeID,cpp:this.options.cpp,p:this.page},onComplete:function(g,h){f.updateComments(g)}});c.send()},updateComments:function(b){if($type(b)!="object"){alert("There was an error processing the request.");return false}this.total=parseInt(b.total_comments)||0;this.page=b.p;var a=b.maxpage;var n=b.p_start;var m=b.p_end;var h=$(this.options.type+"_"+this.options.typeID+"_totalcomments");var g=$(this.options.type+"_"+this.options.typeID+"_comments");var k=$H(b.comments);h.innerHTML=this.total;var f=document.createElement("div");g.empty();var l=this;if(l.Base.Core.settings.setting_url){var e="?"}else{var e="&"}k.each(function(o,q){var r=new Element("div",{id:"comment_"+q});var s="<div style='margin-top: 10px; margin-bottom: 20px;'>";if(o.comment_authoruser_id&&o.comment_authoruser_exists){s+="<div style='float: left; text-align: center; width: 90px;'><a href='"+o.comment_authoruser_url+"'><img src='"+o.comment_authoruser_photo+"' class='photo' width='"+o.comment_authoruser_photo_width+"' border='0'></a></div>"}else{s+="<div style='float: left; text-align: center; width: 90px;'><img src='./images/nophoto.gif' class='photo' width='75' border='0'></div>"}s+="<div style='overflow: hidden;'>";if(!o.comment_authoruser_id){s+="<div class='profile_comment_author'><b>"+l.Base.Language.Translate(835)+"</b></div>"}else{if(!o.comment_authoruser_exists){s+="<div class='profile_comment_author'><b>"+l.Base.Language.Translate(1071)+"</b></div>"}else{s+="<div class='profile_comment_author'><a href='"+o.comment_authoruser_url+"'><b>"+o.comment_authoruser_displayname+"</b></a></div>"}}s+="<div class='profile_comment_date'>"+o.comment_date+"</div>";r.setProperty("html",o.comment_body);s+="<div class='profile_comment_body' id='profile_comment_body_"+q+"'>"+o.comment_body+"&nbsp;</div>";s+="<div class='profile_comment_links'>";var p=new Array();if(l.Base.Viewer.user_exists&&o.comment_authoruser_id&&o.comment_authoruser_exists){if(l.options.commentLinks.reply&&l.Base.Viewer.user_info.user_id==l.Base.Owner.user_info.user_id&&l.Base.Viewer.user_info.user_id!=o.comment_authoruser_id){p.push("<a href='profile.php?user="+o.comment_authoruser_username+"&v=comments'>"+l.Base.Language.Translate(787)+"</a>")}if(l.options.commentLinks.walltowall&&o.comment_authoruser_id!=l.Base.Owner.user_info.user_id&&o.comment_authoruser_private==false){p.push("<a href=\"javascript:TB_show('"+l.Base.Language.Translate(1032)+"', 'profile_comments.php?user="+l.Base.Owner.user_info.user_username+"&user2="+o.comment_authoruser_username+"&TB_iframe=true&height=450&width=550', '', './images/trans.gif');\">"+l.Base.Language.Translate(891)+"</a>")}if(o.comment_authoruser_id!=l.Base.Viewer.user_info.user_id){p.push("<a href=\"javascript:TB_show('"+l.Base.Language.Translate(784)+"', 'user_messages_new.php?to_user="+o.comment_authoruser_displayname+"&to_id="+o.comment_authoruser_username+"&TB_iframe=true&height=400&width=450', '', './images/trans.gif');\">"+l.Base.Language.Translate(834)+"</a>")}if(o.comment_authoruser_id==l.Base.Viewer.user_info.user_id){p.push('<a class="commentEditLink" href="javascript:void(0);" id=\'comment_edit_link_'+q+"'>"+l.Base.Language.Translate(187)+"</a>")}}if((o.comment_authoruser_exists&&o.comment_authoruser_id==l.Base.Viewer.user_info.user_id)||(l.Base.Viewer.user_exists&&l.Base.Viewer.user_info.user_id==l.Base.Owner.user_info.user_id)){p.push('<a class="commentDeleteLink" href="javascript:void(0);" id=\'comment_delete_link_'+q+"'>"+l.Base.Language.Translate(155)+"</a>")}s+=p.join("&nbsp;-&nbsp;");s+="&nbsp;</div></div></div>";r.setProperty("html",s);r.inject(g);if(r.getElement(".commentEditLink")){r.getElement(".commentEditLink").addEvent("click",function(){l.editComment(q)})}if(r.getElement(".commentDeleteLink")){r.getElement(".commentDeleteLink").addEvent("click",function(){l.confirmDelete(q)})}});if(this.options.paginate&&this.total>this.options.cpp){var i=new Element("div",{styles:{"text-align":"center"}});var j=new Element("div",{styles:{"text-align":"center"}});if(this.page>1){var d="<a href='javascript:void(0);' id='comment_last_page_top'>&#171; "+l.Base.Language.Translate(182)+"</a>";var c="<a href='javascript:void(0);' id='comment_last_page_bottom'>&#171; "+l.Base.Language.Translate(182)+"</a>"}else{var d="<font class='disabled'>&#171; "+l.Base.Language.Translate(182)+"</font>";var c="<font class='disabled'>&#171; "+l.Base.Language.Translate(182)+"</font>"}if(n==m){d+="&nbsp;|&nbsp; "+SocialEngine.Language.TranslateFormatted(184,[n,this.total])+"&nbsp;|&nbsp;";c+="&nbsp;|&nbsp; "+SocialEngine.Language.TranslateFormatted(184,[n,this.total])+"&nbsp;|&nbsp;"}else{d+="&nbsp;|&nbsp; "+SocialEngine.Language.TranslateFormatted(185,[n,m,this.total])+"&nbsp;|&nbsp;";c+="&nbsp;|&nbsp; "+SocialEngine.Language.TranslateFormatted(185,[n,m,this.total])+"&nbsp;|&nbsp;"}if(this.page!=a){d+="<a href='javascript:void(0);' id='comment_next_page_top'>"+l.Base.Language.Translate(183)+" &#187;</a>";c+="<a href='javascript:void(0);' id='comment_next_page_bottom'>"+l.Base.Language.Translate(183)+" &#187;</a>"}else{d+="<font class='disabled'>"+l.Base.Language.Translate(183)+" &#187;</font>";c+="<font class='disabled'>"+l.Base.Language.Translate(183)+" &#187;</font>"}i.setProperty("html",d);j.setProperty("html",c);i.inject(g,"top");j.inject(g);if(i.getElement("a[id=comment_last_page_top]")){i.getElement("a[id=comment_last_page_top]").addEvent("click",function(){l.getComments("previous")})}if(j.getElement("a[id=comment_last_page_bottom]")){j.getElement("a[id=comment_last_page_bottom]").addEvent("click",function(){l.getComments("previous")})}if(i.getElement("a[id=comment_next_page_top]")){i.getElement("a[id=comment_next_page_top]").addEvent("click",function(){l.getComments("next")})}if(j.getElement("a[id=comment_next_page_bottom]")){j.getElement("a[id=comment_next_page_bottom]").addEvent("click",function(){l.getComments("next")})}}},addComment:function(c,a,b){if(!this.options.canComment){return false}if(c){$("comment_error").style.display="block";if(!a.trim()){this.addText($("comment_body"));$("comment_error").innerHTML=SocialEngine.Language.Translate(831)}else{$("comment_error").innerHTML=SocialEngine.Language.Translate(832)}$("comment_submit").value=SocialEngine.Language.Translate(833);$("comment_submit").disabled=false}else{$("comment_error").style.display="none";$("comment_error").innerHTML="";$("comment_body").value="";$("comment_body").style.height=this.options.originalHeight+"px";this.addText($("comment_body"));$("comment_submit").value=SocialEngine.Language.Translate(833);$("comment_submit").disabled=false;if($("comment_secure")){$("comment_secure").value="";$("secure_image").src=$("secure_image").src+"?"+(new Date()).getTime()}this.page=1;this.total++;this.getComments()}},editComment:function(c){var f=this;if(this.isEditing){return false}this.isEditing=true;var b=$("profile_comment_body_"+c);var a=b.offsetHeight+10;var d=b.innerHTML.replace(/<br>/gi,"\r\n").replace(/>/gi,"&gt;");var e="";e+="<form action='msep_js.php' method='post' target='ajaxframe' name='editCommentForm'>";e+="<textarea name='comment_edit' id='comment_edit_"+c+"' style='height: "+a+" px; width: 100%;'>"+d+"</textarea>";e+="<input type='hidden' name='task' value='comment_edit'>";e+="<input type='hidden' name='comment_id' value='"+c+"'>";e+="<input type='hidden' name='type' value='"+this.options.type+"'>";e+="<input type='hidden' name='iden' value='"+this.options.typeIdentifier+"'>";e+="<input type='hidden' name='value' value='"+this.options.typeID+"'>";if(this.options.typeTab){e+='<input type="hidden" name="tab" value="'+this.options.typeTab+'">'}if(this.options.typeCol){e+='<input type="hidden" name="col" value="'+this.options.typeCol+'">'}if(this.options.typeTabParent){e+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">'}if(this.options.typeColParent){e+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">'}if(this.options.typeChild){e+='<input type="hidden" name="child" value="1">'}e+="</form>";b.innerHTML=e;textarea_autogrow("comment_edit_"+c);$("comment_edit_"+c).focus();$("comment_edit_"+c).addEvent("blur",function(){f.doCommentEdit();f.isEditing=false})},confirmDelete:function(a){$("del_comment_id").value=a;TB_show(SocialEngine.Language.Translate(1025),"#TB_inline?height=100&width=300&inlineId=confirmcommentdelete","","../images/trans.gif");var b=this;$("TB_window").getElement("form").name="commentDeleteForm";$("TB_window").getElement("form").addEvent("submit",function(c){b.doCommentDelete(c,a)})},removeText:function(a){if(!this.changed){a.value="";a.style.color="#000000";this.changed=true}},addText:function(a){if(!a.value.trim()){a.value=SocialEngine.Language.Translate(829);a.style.color="#888888";this.changed=false}},checkText:function(a){if(!this.changed){$("comment_body").value=""}$("comment_submit").value=SocialEngine.Language.Translate(830);$("comment_submit").disabled=true}});

msepAPI.prototype.Menu = new Class(
{
      Implements: [Options, Events],

      options:
      {
            open_menu: null,
            current_timeout: new Array(),
            childs: null,
            is_child: false
      },

      initialize: function()
      {

      },

      showMenu: function(id1)
      {
            var self = this;

            if($(id1))
            {
                  if($(id1).style.display == 'none')
                  {
                        if($(this.options.open_menu))
                        {
                              self.hideMenu($(this.options.open_menu));
                        }

                        $(id1).setStyle("display", "inline");

                        if (!self.options.is_child)
                        {
                              this.startMenuTimeout($(id1));

                              $(id1).addEvent('mouseover', function(e)
                              {
                                    if (self.options.childs != null)
                                    {
                                          self.options.childs.each(function(child)
                                          {
                                                self.killMenuTimeout($(child), true);
                                          });
                                    }

                                    self.killMenuTimeout(this, false);
                              });


                              $(id1).addEvent('mouseout', function(e)
                              {
                                    if (self.options.childs != null)
                                    {
                                          self.options.childs.each(function(child)
                                          {
                                                self.startMenuTimeout($(child), true);
                                          });
                                    }

                                    self.startMenuTimeout(this, false);
                              });
                        }

                        this.options.open_menu = id1;
                  }
            }
      },

      killMenuTimeout: function(divEl, child)
      {
            if (child == false)
            {
                  clearTimeout(this.options.current_timeout[divEl.id]);
                  this.options.current_timeout[divEl.id] = '';
            }
      },

      startMenuTimeout: function(divEl, child)
      {
            var self = this;

            if (this.options.current_timeout[divEl.id] == '' && child == false)
            {
                  this.options.current_timeout[divEl.id] = setTimeout(function() { self.hideMenu(divEl); }, 1000);
            }
      },

      hideMenu: function(divEl)
      {
            var self = this;

            if (!self.options.is_child)
            {
                  divEl.setStyle("display", "none");
                  this.options.current_timeout[divEl.id] = '';

                  divEl.removeEvent('mouseover', function(e)
                  {
                        if (self.options.childs != null)
                        {
                              self.options.childs.each(function(child)
                              {
                                    self.killMenuTimeout($(child), true);
                              });
                        }

                        self.killMenuTimeout(this);
                  });

                  divEl.removeEvent('mouseout', function(e)
                  {
                        if (self.options.childs != null)
                        {
                              self.options.childs.each(function(child)
                              {
                                    self.killMenuTimeout($(child), true);
                              });
                        }

                        self.startMenuTimeout(this);
                  });
            }
      }
});